GetCapture (coredll)
Last changed: -212.140.133.126

.
Summary
Retrieve a handle to the window that has captured mouse/stylus input.

C# Signature:

[DllImport("user32.dll")]
static extern IntPtr GetCapture();

VB .NET Signature:

Declare Function GetCapture Lib "user32.dll" () As IntPtr

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

You can use GetCapture in conjunction with SetCapture to obtain the window handle of a Control. See the sample code below.

Sample Code:

public IntPtr GetHWnd(Control ctrl)
{
   IntPtr hOldWnd = GetCapture();
   ctrl.Capture = true;
   IntPtr hWnd = GetCapture();
   ctrl.Capture = false;
   SetCapture(hOldWnd);
   return hWnd;
}

Alternative Managed API:

None

Documentation
GetCapture on MSDN